package com.zdemo.inc;

public class Square {

	private LengthPair lengthPair = new LengthPair();

	public LengthPair getLengthPair() {
		return lengthPair;
	}

	public void setLengthPair(LengthPair lengthPair) {
		this.lengthPair = lengthPair;
	}
	
	public Integer initAndGetLen(Integer width) {
		if(this.lengthPair.getWidth().intValue() != width.intValue()) {
			Integer height = width;
			this.lengthPair = new LengthPair(height, width);
		}
		try {
			Thread.sleep((long) (Math.random() * 10 + 1));
		} catch(InterruptedException e) {
			e.printStackTrace();
		};
		return this.lengthPair.getLen(width).intValue();
	}
}
